﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Project.Admin
{
    public partial class ListOrder : System.Web.UI.Page
    {
        DataPOFDataContext db = new DataPOFDataContext();
        protected void Page_Load(object sender, EventArgs e)
        {

            DataPOFDataContext db = new DataPOFDataContext();
            string acc = (from x in db.AccountLogins where x.Username == Session["username"].ToString() select x.FullName).FirstOrDefault();
            Label1.Text = acc;
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            Session["username"] = null;
            Response.Cache.SetNoStore();
            Response.CacheControl = "no-cache";
            Response.Redirect("../Home/Login.aspx");
        }

        protected void Button1_Click1(object sender, EventArgs e)
        {
            string IDorder = DropDownList1.SelectedItem.ToString();
            Label2.Text = IDorder;
            int IDCustomer = (from x in db.OrderDetails where x.Id == Convert.ToInt32(IDorder) select x.CustomerOrderID).FirstOrDefault();
            string Name = (from x in db.CustomerOrders where x.ID == Convert.ToInt32(IDCustomer) select x.Name).FirstOrDefault();
            Label3.Text = Name.ToString();
            Label4.Text = (from x in db.OrderDetails where x.Id == Convert.ToInt32(IDorder) select x.ReceiverName).FirstOrDefault();
            int IDRoute = (from x in db.OrderDetails where x.Id == Convert.ToInt32(IDorder) select x.RouteID).FirstOrDefault();
            Label5.Text = (from x in db.Routes where x.ID == IDRoute select x.Route1).FirstOrDefault();
            int volume = (from x in db.OrderDetails where x.Id == Convert.ToInt32(IDorder) select x.Volume).FirstOrDefault();
            Label6.Text = volume.ToString();
            Label7.Text = (from x in db.OrderDetails where x.Id == Convert.ToInt32(IDorder) select x.Price).FirstOrDefault().ToString();
        }
    }
}